import Vue from 'vue'
// import echarts from 'echarts'
import Element from 'element-ui'
// import vConsole from '@/utils/vconsole'
import babelPolyfill from 'babel-polyfill'

import App from '@/App'
import i18n from '@/i18n'
import router from '@/router'
import store from '@/store'
import '@/icons'
import '@/element-ui/theme/index.css'
import '@/assets/scss/aui.scss'
import http from '@/utils/http'
import request from '@/utils/request'
import { hasPermission, getDictLabel, getWrDictLabel } from '@/utils'
import cloneDeep from 'lodash/cloneDeep'
import { setStorage, getStorage, removeStorage, setLocalStorage, getLocalStorage } from '@/utils/storage'
import * as filters from './filters'
import VueLazyload from 'vue-lazyload'
// import VueKindEditor from './plugin/kindeditor.js'
// import '../public/kindeditor/themes/default/default.css'
// import '../public/kindeditor/kindeditor-all.js'
// import '../public/kindeditor/lang/zh-CN.js'
import '../public/js/rem/rem.js'
import {
  message
} from './store/modules/user'

import VueAnimateNumber from 'vue-animate-number'
import { state } from '@/observable'
// Vue.prototype.$echarts = echarts
import highcharts from 'highcharts'

import highcharts3d from 'highcharts/highcharts-3d'
Vue.use(VueAnimateNumber)
Vue.config.productionTip = false
Vue.use(Element, {
  size: 'default',
  i18n: (key, value) => i18n.t(key, value)
})
// Vue.use(vConsole);
Vue.prototype.$message = message
Vue.prototype.$state = state

Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

Vue.use(VueLazyload, {
  preLoad: 1.3,
  error: require('@/assets/img/planmate.jpg'),
  loading: require('@/assets/img/planmate.jpg'),
  attempt: 1
})

// 挂载全局
Vue.prototype.$http = http
Vue.prototype.$request = request
Vue.prototype.$hasPermission = hasPermission
Vue.prototype.$getDictLabel = getDictLabel
Vue.prototype.$getWrDictLabel = getWrDictLabel
Vue.prototype.setStorage = setStorage
Vue.prototype.getStorage = getStorage
Vue.prototype.removeStorage = removeStorage
Vue.prototype.setLocalStorage = setLocalStorage
Vue.prototype.getLocalStorage = getLocalStorage
Vue.prototype.$eventHub = Vue.prototype.$eventHub || new Vue()

highcharts3d(highcharts)
// 保存整站vuex本地储存初始状态
window.SITE_CONFIG['storeState'] = cloneDeep(store.state)

console.log('main.js')

new Vue({
  i18n,
  router,
  store,
  render: h => h(App)
}).$mount('#app')
